﻿using StoryTeller.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StoryTeller.Infrastructure.DataAccess.Parser
{
    public static class ContributionRatingParser
    {
        public static ContributionRating ParseEntityToDomain(this EContributionRating entity)
        {
            ContributionRating cr = new ContributionRating();

            cr.LastUpdate = entity.LastUpdate;
            cr.CreationDate = entity.CreationDate;
            cr.Contribution = entity.Contribution.ParseEntityToDomain();
            cr.User = entity.User.ParseEntityToDomain();
            cr.Rate = entity.Rate;

            return cr;
        }

        public static EContributionRating ParseDomainToEntity(this ContributionRating domain)
        {
            EContributionRating cr = new EContributionRating();

            cr.LastUpdate = domain.LastUpdate;
            cr.CreationDate = domain.CreationDate;
            cr.Contribution = domain.Contribution.ParseDomainToEntity();
            cr.User = domain.User.ParseDomainToEntity();
            cr.Rate = domain.Rate;

            return cr;
        }
    }
}
